package com.tl.app.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tl.app.domain.AppGiftUser;
import com.tl.app.mapper.AppGiftUserMapper;
import com.tl.app.service.IAppGiftUserService;
import com.tl.common.utils.DateUtils;

/**
 * 打赏礼物Service业务层处理
 * 
 * @author suhp
 * @date 2024-07-28
 */
@Service
public class AppGiftUserServiceImpl implements IAppGiftUserService 
{
    @Autowired
    private AppGiftUserMapper appGiftUserMapper;

    /**
     * 查询打赏礼物
     * 
     * @param id 打赏礼物主键
     * @return 打赏礼物
     */
    @Override
    public AppGiftUser selectAppGiftUserById(Long id)
    {
        return appGiftUserMapper.selectAppGiftUserById(id);
    }

    /**
     * 查询打赏礼物列表
     * 
     * @param appGiftUser 打赏礼物
     * @return 打赏礼物
     */
    @Override
    public List<AppGiftUser> selectAppGiftUserList(AppGiftUser appGiftUser)
    {
        return appGiftUserMapper.selectAppGiftUserList(appGiftUser);
    }

    /**
     * 新增打赏礼物
     * 
     * @param appGiftUser 打赏礼物
     * @return 结果
     */
    @Override
    public int insertAppGiftUser(AppGiftUser appGiftUser)
    {
        appGiftUser.setCreateTime(DateUtils.getNowDate());
        return appGiftUserMapper.insertAppGiftUser(appGiftUser);
    }

    /**
     * 修改打赏礼物
     * 
     * @param appGiftUser 打赏礼物
     * @return 结果
     */
    @Override
    public int updateAppGiftUser(AppGiftUser appGiftUser)
    {
        appGiftUser.setUpdateTime(DateUtils.getNowDate());
        return appGiftUserMapper.updateAppGiftUser(appGiftUser);
    }

    /**
     * 批量删除打赏礼物
     * 
     * @param ids 需要删除的打赏礼物主键
     * @return 结果
     */
    @Override
    public int deleteAppGiftUserByIds(Long[] ids)
    {
        return appGiftUserMapper.deleteAppGiftUserByIds(ids);
    }

    /**
     * 删除打赏礼物信息
     * 
     * @param id 打赏礼物主键
     * @return 结果
     */
    @Override
    public int deleteAppGiftUserById(Long id)
    {
        return appGiftUserMapper.deleteAppGiftUserById(id);
    }
    
    
	@Override
	public Map<String, Object> selectAppGiftUserByClerkInfo(Long userId,String userType) {
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("list", appGiftUserMapper.selectAppGiftUserByClerkId(userId,userType));
		map.put("tj", appGiftUserMapper.selectAppGiftUserByClerkIdAndDlNum(userId));
		return map;
	}
}
